﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using com.google.zxing;
using com.google.zxing.qrcode;

namespace 二维码
{
    public partial class Form1 : Form
    {
        
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //二维码要存储的内容
            string codeString = " ";
            //生成二维码并返回Bitmap
            Bitmap bitmap = ZxingHelper.CreateQRCode(codeString);
            //保存图片到本地
            //bitmap.Save(@"C:\C:\Users\PC\Desktop\zym\a.bmp");
            //将Bitmap转换成Image对象
            Image img = Image.FromHbitmap(bitmap.GetHbitmap());
            //设置pictureBox的图片源
            this.pictureBox1.Image = img;
        }
    }
}
